package com.jeesite.modules.dto;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 支付订单DTO类 - 用于避免StackOverflowError
 * @author LaVenderGong
 * @version 2025-08-19
 */
public class PaymentOrderDto {
    
    private String orderId;                  // 订单ID
    private Long donationId;                 // 捐赠记录ID
    private String paymentMethod;            // 支付方式
    private BigDecimal amount;               // 支付金额
    private String status;                   // 订单状态
    private String thirdPartyOrderId;        // 第三方订单号
    private Date createTime;                 // 创建时间
    private Date payTime;                    // 支付时间
    private String callbackData;             // 回调数据
    
    // 订单状态常量
    public static final String STATUS_CREATED = "CREATED";      // 已创建
    public static final String STATUS_PAYING = "PAYING";        // 支付中
    public static final String STATUS_SUCCESS = "SUCCESS";      // 支付成功
    public static final String STATUS_FAILED = "FAILED";        // 支付失败
    public static final String STATUS_CANCELLED = "CANCELLED";  // 已取消
    
    public PaymentOrderDto() {
    }
    
    public PaymentOrderDto(String orderId) {
        this.orderId = orderId;
    }
    
    // Getter and Setter methods
    public String getOrderId() {
        return orderId;
    }
    
    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }
    
    public Long getDonationId() {
        return donationId;
    }
    
    public void setDonationId(Long donationId) {
        this.donationId = donationId;
    }
    
    public String getPaymentMethod() {
        return paymentMethod;
    }
    
    public void setPaymentMethod(String paymentMethod) {
        this.paymentMethod = paymentMethod;
    }
    
    public BigDecimal getAmount() {
        return amount;
    }
    
    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }
    
    public String getStatus() {
        return status;
    }
    
    public void setStatus(String status) {
        this.status = status;
    }
    
    public String getThirdPartyOrderId() {
        return thirdPartyOrderId;
    }
    
    public void setThirdPartyOrderId(String thirdPartyOrderId) {
        this.thirdPartyOrderId = thirdPartyOrderId;
    }
    
    public Date getCreateTime() {
        return createTime;
    }
    
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    
    public Date getPayTime() {
        return payTime;
    }
    
    public void setPayTime(Date payTime) {
        this.payTime = payTime;
    }
    
    public String getCallbackData() {
        return callbackData;
    }
    
    public void setCallbackData(String callbackData) {
        this.callbackData = callbackData;
    }
    
    /**
     * 检查订单是否支付成功
     */
    public boolean isPaymentSuccess() {
        return STATUS_SUCCESS.equals(this.status);
    }
    
    /**
     * 检查订单是否已取消
     */
    public boolean isCancelled() {
        return STATUS_CANCELLED.equals(this.status);
    }
    
    /**
     * 检查订单是否支付失败
     */
    public boolean isPaymentFailed() {
        return STATUS_FAILED.equals(this.status);
    }
    
    /**
     * 检查订单是否正在支付中
     */
    public boolean isPaying() {
        return STATUS_PAYING.equals(this.status) || STATUS_CREATED.equals(this.status);
    }
}
